1. Field of the Invention
The present invention relates to a graphics drawing apparatus provided with a register address generating device for automatically generating drawing parameter register addresses required for the drawing according to type and a method of the same.
2. Description of the Related Art
A computer graphics drawing engine draws primitives by setting color information, position information, and other drawing parameters of vertexes of triangles, straight lines, or other primitives to be drawn.
FIG. 1 is a view of an example of a drawing primitive and drawing parameters when drawing a triangular primitive.
As shown in FIG. 1, the drawing parameters of each vertex of the triangular primitive include color information, depth information, and attribute information.
Specifically, the drawing parameters of a vertex 1 include R (red) 1, G (green) 1, B (blue) 1, and a (alpha blend coefficient) 1 as the color information, include Z1 as the depth information, and include F (fog coefficient) 1 etc. as the attribute information.
Similarly, the drawing parameters of a vertex 2 include R2, G2, B2, and α2 as the color information, include Z2 as the depth information, and include F2 etc. as the attribute information.
The drawing parameters of a vertex 3 include R3, G3, B3, and α3 as the color information, include Z3 as the depth information, and include F3 etc. as the attribute information.
Usually, the drawing parameters of each vertex are set from a former geometric operation engine, CPU, etc. (hereinafter referred to as a “former engine”) for coordinate conversion etc. As shown in FIG. 2, a former engine 1 and a drawing engine 2 are connected by a certain restricted bus size (32-bit size in the example of FIG. 2) in many cases.
As shown in FIG. 3, the former engine 1 has an address generator 11. The drawing engine 2 has, as shown in FIG. 3, drawing parameter registers 21-1 (R1), 21-2 (R2), . . . , 21-n (f3) and a decoder 22.
The drawing parameters are set in the drawing parameter registers 21-1 (R1), 21-2 (R2), . . . , 21-n (f3) provided inside the drawing engine 2.
The drawing parameters are selected by an address bus 3. Desired data transferred through a data bus 4 is written in the drawing parameter registers 22-1 to 22-n selected by the address bus 3 and decoded by the decoder 22.
The addresses of the drawing parameter registers used are values fixed in advance. Accordingly, the former engine 1 for writing the drawing parameters must generate the addresses of the drawing parameter registers corresponding to the drawing parameters to be written by the address generator 11 and transfer the same to the drawing engine 2.
The data strings given from the former engine 1 to the drawing engine 2 are comprised of addresses and data strings and become as shown in FIG. 4.
Specifically, when writing the drawing parameter R1 (color information) into the drawing parameter register 21-1, the data string becomes a data string comprised of the 7-bit address r1 generated at the address generator 11 and 32-bit drawing parameter R1.
When writing the drawing parameter G1 (color information) into the drawing parameter register 21-2, the data string becomes a data string comprised of the 7-bit address g1 generated at the address generator 11 and the 32-bit drawing parameter G1.
When writing the drawing parameter F3 (fog coefficient) into the drawing parameter register 21-n, the data string becomes a data string comprised of the 7-bit address f3 generated at the address generator 11 and the 32-bit drawing parameter F3.
The drawing parameters which must be set in the drawing engine 2 are determined, as shown in FIG. 5, according to the drawing type such as texture mapping, fog blending, and alpha blending.
Once the drawing type is determined, the drawing type is rarely changed until a certain set amount of primitives finishes being generated. In the address generator 11, as shown in FIG. 6, a certain fixed address is repeatedly set during that time.
Summarizing the problem to be solved by the invention, a configuration where data is directly written into the drawing parameter registers 21-1 to 21-n of the drawing engine 2 is from a memory storing in advance the drawing parameters to be written via a direct memory access (DMA) controller may also be considered.
In this case, the DMA controller has to add the addresses of the corresponding drawing parameter registers to the data in accordance with the drawing parameters to be written into the drawing engine 2.
The addresses to be added are comprised of about 7 bits, but in general DMA transfer, DMA packets are generated with the bit size of the data boundary of the memory, for example, 32 bits. Therefore, as shown in FIG. 7, the data size of the DMA packets becomes twice that of the drawing parameters to be transferred.
Namely, in the transfer of data by DMA transfer, the amount of the data transferred becomes a bottleneck of performance in many cases.